//
//  MXMineItemDetailTableViewCell.m
//  MXの衣柜
//
//  Created by 马霄 on 15/8/26.
//  Copyright (c) 2015年 霄 马. All rights reserved.
//

#import "MXMineItemDetailTableViewCell.h"



@interface MXMineItemDetailTableViewCell ()
@property (nonatomic, retain) UIView *line;
@end
@implementation MXMineItemDetailTableViewCell
- (void)dealloc
{
    [_line release];
    [_mainImageView release];
    [_titleLabel release];
    [_priceLabel release];
    [super dealloc];
}


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        self.mainImageView = [[[UIImageView alloc] init] autorelease];
        self.mainImageView.backgroundColor = [UIColor whiteColor];
        [self.contentView addSubview:self.mainImageView];
        
        self.titleLabel = [[[UILabel alloc] init] autorelease];
        self.titleLabel.backgroundColor = [UIColor whiteColor];
        self.titleLabel.font = [UIFont boldSystemFontOfSize:16];
        self.titleLabel.numberOfLines = 0;
        [self.contentView addSubview:self.titleLabel];
        
        self.priceLabel = [[[UILabel alloc] init] autorelease];
        self.priceLabel.backgroundColor = [UIColor whiteColor];
        self.priceLabel.font = [UIFont systemFontOfSize:16];
        self.priceLabel.textColor = [UIColor redColor];
        [self.contentView addSubview:self.priceLabel];
        
        self.line = [[[UIView alloc] init] autorelease];
        self.line.backgroundColor = [UIColor blackColor];
        [self.contentView addSubview:self.line];
        
        
        
    }
    return self;
}

-(void)layoutSubviews
{
    CGFloat mainImageViewX = WIDTHPRO * 10;
    CGFloat mainImageViewY = HEIGHTPRO * 10;
    CGFloat mainImageViewW = WIDTH - 2 * mainImageViewX;
    CGFloat mainImageViewH = HEIGHTPRO * 400;
    self.mainImageView.frame = CGRectMake(mainImageViewX, mainImageViewY, mainImageViewW, mainImageViewH);
    
    CGFloat titleLabelX = mainImageViewX;
    CGFloat titleLabelY = CGRectGetMaxY(self.mainImageView.frame);
    CGFloat titleLabelW = mainImageViewW;
    CGFloat titleLabelH = HEIGHTPRO * 40;
    self.titleLabel.frame = CGRectMake(titleLabelX, titleLabelY, titleLabelW, titleLabelH);
    
    
    CGFloat lineX = 0;
    CGFloat lineY = CGRectGetMaxY(self.titleLabel.frame);
    CGFloat lineW = WIDTH;
    CGFloat lineH = HEIGHTPRO * 1;
    self.line.frame = CGRectMake(lineX, lineY, lineW, lineH);
    
    
    CGFloat priceLabelX = titleLabelX;
    CGFloat priceLabelY = CGRectGetMaxY(self.titleLabel.frame);
    CGFloat priceLabelW = titleLabelW;
    CGFloat priceLabelH = HEIGHTPRO * 20;
    self.priceLabel.frame = CGRectMake( priceLabelX, priceLabelY, priceLabelW, priceLabelH);
}




- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
